package com.baosight.risk.web.rire;

import com.baosight.risk.api.rire.RireRiskEventService;
import com.baosight.risk.api.riri.IRiriRiskService;
import com.baosight.risk.base.controller.BaseController;
import com.baosight.risk.service.rire.entity.RireRiskEvent;
import com.baosight.risk.service.rire.vo.RireRiskEventVO;
import com.baosight.risk.service.riri.entity.RiriRisk;
import com.baosight.risk.service.riri.vo.RiriRiskVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/rire/interface")
public class RireInterfaceController extends BaseController {

    @Autowired
    private RireRiskEventService eventService;

    /**
     * 重大风险事件库查询服务接口
     * @param vo
     * @return
     */
    @PostMapping("queryRiskEventData")
    public Object queryRiskEventData(@RequestBody RireRiskEventVO vo) {
        Map data=new HashMap<>();
        data.put("status","1");
        data.put("message","查询成功");
        try{
            List<RireRiskEvent> eventList =eventService.queryRiskEventData(vo);
            data.put("eventList",eventList);
        }catch (Exception e){
            data.put("status","0");
            data.put("message",e.getMessage());
        }
        return data;
    }


}